<template>
  <div>
    <basic-container>
      <!-- START goBack -->
      <div class="el-page-header haruyuki-mb-20">
        <div class="haruyuki-page-header-left haruyuki-size-18" @click="goBack">
          <i class="el-icon-arrow-left"></i>
          <div class="haruyuki-size-24">返回</div>
        </div>
      </div>
      <!-- END goBack -->
      <div
        class="el-page-header__content"
        style="padding-bottom: 20px; text-align: center; font-size: 30px"
      >
        退款订单审核
      </div>

      <section class="haruyuki-bg-color-white" style="font-size: 18px">
        <div class="haruyuki-flex-space-between haruyuki-align-items-center">
          <div class="haruyuki-content">
            <el-row :gutter="180" style="font-size: 18px">
              <el-col :span="24">
                <span>退款编号:{{ examineData.shopRefundNo }}</span>
              </el-col>

              <el-col :span="24">
                <span>订单总金额：{{ examineData.shopRefundTotal }}</span>
              </el-col>

              <el-col :span="24">
                备注内容:
                <el-input
                  type="textarea"
                  :rows="5"
                  v-model="examineData.shopExRemarks"
                ></el-input>
              </el-col>
            </el-row>
          </div>
        </div>
        <div style="text-align: center">
          <el-button
            style="width: 120px; height: 50px; font-size: large"
            type="primary"
            size="primary"
            @click="handleReject()"
            >驳回</el-button
          >
          <el-button
            style="width: 120px; height: 50px; font-size: large"
            type="primary"
            size="primary"
            @click="handleRefund()"
            >通过</el-button
          >
        </div>
      </section>
    </basic-container>
  </div>
</template>
  
  <script>
import { detailRefundById, update } from "@/api/rb-oem/shopRefund/shop_refund";

import { mapGetters } from "vuex";
import basicForm from "@/components/rb-service/basic-form";

export default {
  components: {
    basicForm,
  },
  data() {
    return {
      labelData: {
        basicTitle: "订单详情",
      },
      shopOrderId: this.$route.query.id,
      dialogVisible: false,
      passVisible: false,
      dialogText: "",
      active: 0,
      policyVisible: false,
      service: {},
      examineData: {
        id: "",
        shopRefundNo: "",
        shopOrderNo: "",
        shopSerialNo: "",
        shopClassName: "",
        shopTypeName: "",
        shopModelName: "",
        shopRefundTotal: "",
        shopLogisticsNo: "",
        shopDeliveryMethod: "",
        shopLogisticsCompany: "",
        serviceNo: "",
        serviceName: "",
        shopConsignee: "",
        shopConsigneePhone: "",
        shopConsigneeAddress: "",
        shopOrderStatus: "",
        shopRemarks: "",
        shopExRemarks: "",
      },
    };
  },
  computed: {
    ...mapGetters(["permission"]),
    permissionList() {
      return {
        addBtn: this.vaildData(this.permission.shop_order_add, false),
        viewBtn: this.vaildData(this.permission.shop_order_view, false),
        delBtn: this.vaildData(this.permission.shop_order_delete, false),
        editBtn: this.vaildData(this.permission.shop_order_edit, false),
      };
    },
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
        ids.push(ele.id);
      });
      return ids.join(",");
    },
    exhibition() {
      return (val) => {
        if (val == "" || val == "-1") {
          return (val = 0);
        } else {
          return val;
        }
      };
    },
    getYearMonth() {
      return (date) => {
        let result = (date + "").split(" ");
        return result[0];
      };
    },
  },
  created() {
    this.doGetDicts();
    this.infoData(this.shopOrderId);
  },
  methods: {
    /* 返回页面 */
    goBack() {
      this.$router.$avueRouter.closeTag();
      this.$router.back();
    },

    /* 字典 */
    doGetDicts() {},
    /* 页面加载 初始化请求详情接口 */
    infoData(id) {
      detailRefundById(id).then((res) => {
        this.examineData = res.data.data;
      });
    },
    /* 审核驳回处理 */
    handleReject() {
      this.$confirm("确认驳回?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        this.examineData.shopOrderStatus = "2";
        update(this.examineData).then((res) => {
          if (res.status == "200") {
            this.infoData(this.shopOrderId);
            this.$message({
              type: "success",
              message: "操作成功!",
            });
          } else {
            this.$message({
              type: "error",
              message: res.data.message,
            });
          }
        });
        this.goBack().then(() => {});
      });
    },

    /* 审核通过处理 */
    handleRefund() {
      this.$confirm("确认通过?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        this.examineData.shopOrderStatus = "3";
        update(this.examineData).then((res) => {
          if (res.status == "200") {
            this.infoData(this.shopOrderId);
            this.$message({
              type: "success",
              message: "操作成功!",
            });
          } else {
            this.$message({
              type: "error",
              message: res.data.message,
            });
          }
        });
        this.goBack().then(() => {});
      });
    }
  },
};
</script>
  
  <style lang="scss" scoped>
/deep/.el-transfer-panel__list.is-filterable {
  width: 400px !important;
  height: 500px !important;
}

/deep/.el-transfer-panel {
  width: 400px !important;
  height: 500px !important;
}

.picture-preview {
  color: #409eff;
  cursor: pointer;
}

.haruyuki-image-preview {
  width: 260px;
}
.image-preview-title {
  // text-align: center;
  margin-bottom: 10px;
}
.haruyuki-image-preview .haruyuki-image .el-image {
  border-radius: 10px;
}

/deep/ .el-image__error {
  background: #fff;
}
.infoWrap_line {
  display: flex;
  align-items: center;
  padding-bottom: 30px;
  .info_line_span {
    width: 160px;
    text-align: right;
  }
}
.nullData {
  text-align: center;
  font-size: 24px;
  font-weight: bold;
}
.w100 {
  width: calc(100% - 160px);
}
.btnCode {
  width: 100px;
  border-radius: 0;
  padding: 0;
  margin: 10px 0;
  background: #409eff !important;
}
.btnCode:hover {
  padding: 0;
  border: none;
  background: #409eff !important;
}
/deep/ .el-input-group__append {
  background: #409eff !important;
  color: #fff !important;
  padding: 0;
}
</style>